-
-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Switzerland #195
Improve Switzerland #195
Conversation
- maintainability: refactor regions/cantons - support more advanced regional holiday calculations - add labor day - add rumantsch as language - maintainability: use english as default language (not german) - add more tests
I do prefer it to return the most general language by default. $holidays = Holidays::for('ch')->get(); // German by default instead of English |
@@ -7,6 +7,42 @@ | |||
use Spatie\Holidays\Exceptions\InvalidRegion; | |||
use Spatie\Holidays\Holidays; | |||
|
|||
dataset('cantons', [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think all cantons need a specific snapshot test. You can only verify the edge cases, which is more explicit.
->toBeArray() | ||
->not()->toBeEmpty(); | ||
|
||
expect(formatDates($holidays))->toMatchSnapshot(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for a big snapshot tests here. You can just verify if a certain holiday name is present.
})->with('languages'); | ||
|
||
it('does use native language for epiphany', function (string $canton, string $name, string $locale) { | ||
CarbonImmutable::setTestNowAndTimezone('2024-01-01'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CarbonImmutable::setTestNowAndTimezone('2024-01-01'); | |
CarbonImmutable::setTestNow('2024-01-01'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be found multiple times in the tests
I don't really agree this solution is more readable and easier to maintain |
Thanks for your efforts and feel free to reopen if you're still planning to update this PR! |
Improve Switzerland
This pull requests aims to resolve #193 and adds various imrovements whilst refactoring the code to make it more maintainable.
Whilst the original implementation relied on wikipedia. This pull request implements the holidays communicated by the federal bureau of justice FOJ.